package com.firemoss.atonement.test.metadata
{
	import com.firemoss.atonement.metadata.AtonementMetadata;
	import com.firemoss.atonement.metadata.DefaultMetadataBuilder;
	import com.firemoss.atonement.metadata.IMetadataBuilder;
	import com.firemoss.atonement.test.metadata.inspectors.entity.objects.TestEntity;
	
	import org.flexunit.asserts.assertFalse;
	import org.flexunit.asserts.assertTrue;

	public class MetadataBuilderTests
	{		
		
		[Test]
		public function metadata_for_a_class_should_be_cached() : void
		{
			var builder : IMetadataBuilder = new DefaultMetadataBuilder()
			
			var md1 : AtonementMetadata = builder.buildMetadata( TestEntity );
			var md2 : AtonementMetadata = builder.buildMetadata( TestEntity );
			
			assertTrue( md1 == md2 );
		}
		
		[Test]
		public function metadata_states_if_a_class_is_an_entity() : void
		{
			var builder : IMetadataBuilder = new DefaultMetadataBuilder()
			
			var md1 : AtonementMetadata = builder.buildMetadata( TestEntity );
			assertTrue( md1.isEntity )
			var md2 : AtonementMetadata = builder.buildMetadata( {} );
			assertFalse( md2.isEntity )
		}
		
	}
}